﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ESHOP.Domain;
using System.Web.UI;
using ESHOP.Domain;
using ESHOP.UTIL;

namespace E_Shop.Common
{
    public class Authentication:Page
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            Authenticate();
        }
        public void Authenticate()
        {
        }
        public ACOUNT Acount
        {
            get
            {
                return Session[Constants.SESSION_LOGIN] as ACOUNT;
            }
            set
            {
                value=Session[Constants.SESSION_LOGIN] as ACOUNT;
            }
        }
        #region company
        public void ShowError(string message, string controlId)
        {
            ((Company)Page.Master).ShowError(message, controlId);
        }

        public void ShowError(string message)
        {
            ((Company)Page.Master).ShowError(message);
        }

        public void ShowInfor(string message)
        {
            ((Company)Page.Master).ShowInfor(message);
        }

        public void UnblockDialog(string divId)
        {
            var master = (Company)Page.Master;
            if (master != null) master.UnblockDialog(divId);
        }

        public void CloseWaitingDialog()
        {
            ((Company)Page.Master).CloseWaitingDialog();
        }

        public void SetReadonly(string id, bool isReadonly)
        {
            ((Company)Page.Master).SetReadonly(id, isReadonly);
        }

        public void SetControlValue(string id, string value)
        {
            ((Company)Page.Master).SetControlValue(id, value);
        }

        public void HideDialog(string divId)
        {
            ((Company)Page.Master).HideDialog(divId);
        }

        public void SetLabel(string id, string value)
        {
            var master = (Company)Page.Master;
            if (master != null) master.SetLabel(id, value);
        }

        public void ShowWarning(string message)
        {
            var master = (Company)Page.Master;
            if (master != null) master.ShowWarning(message);
        }

        public void UnblockWaitingDialog()
        {
            var master = (Company)Page.Master;
            if (master != null) master.UnblockWaitingDialog();
        }

        public void FocusAndSelect(string controlId)
        {
            ((Company)Page.Master).FocusAndSelect(controlId);
        }
#endregion
        #region sitemaster
        public void ShowError_sitermaster(string message, string controlId)
        {
            ((SiteMaster)Page.Master).ShowError_sitermaster(message, controlId);
        }

        public void ShowError_sitermaster(string message)
        {
            ((SiteMaster)Page.Master).ShowError_sitermaster(message);
        }

        public void ShowInfor_sitermaster(string message)
        {
            ((SiteMaster)Page.Master).ShowInfor_sitermaster(message);
        }

        public void UnblockDialog_sitermaster(string divId)
        {
            var master = (SiteMaster)Page.Master;
            if (master != null) master.UnblockDialog_sitermaster(divId);
        }

        public void CloseWaitingDialog_sitermaster()
        {
            ((SiteMaster)Page.Master).CloseWaitingDialog_sitermaster();
        }

        public void SetReadonly_sitermaster(string id, bool isReadonly)
        {
            ((SiteMaster)Page.Master).SetReadonly_sitermaster(id, isReadonly);
        }

        public void SetControlValue_sitermaster(string id, string value)
        {
            ((SiteMaster)Page.Master).SetControlValue_sitermaster(id, value);
        }

        public void HideDialog_sitermaster(string divId)
        {
            ((SiteMaster)Page.Master).HideDialog_sitermaster(divId);
        }

        public void SetLabel_sitermaster(string id, string value)
        {
            var master = (SiteMaster)Page.Master;
            if (master != null) master.SetLabel_sitermaster(id, value);
        }

        public void ShowWarning_sitermaster(string message)
        {
            var master = (SiteMaster)Page.Master;
            if (master != null) master.ShowWarning_sitermaster(message);
        }

        public void UnblockWaitingDialog_sitermaster()
        {
            var master = (SiteMaster)Page.Master;
            if (master != null) master.UnblockWaitingDialog_sitermaster();
        }

        public void FocusAndSelect_sitermaster(string controlId)
        {
            ((SiteMaster)Page.Master).FocusAndSelect_sitermaster(controlId);
        }
        #endregion

    }
    
}